package com.jackstraw.jack_base.rules.config;


import com.jackstraw.jack_base.rules.service.RuleBizService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
import org.springframework.util.StopWatch;

/**
 * 执行场景和规则的初始化
 */
@Slf4j
@Component
public class RuleInitRunner implements CommandLineRunner {

    @Autowired
    private RuleBizService ruleBizService;

    @Override
    public void run(String... args) throws Exception {
        StopWatch stopWatch = new StopWatch();
        stopWatch.start();
        log.info("*************项目启动，执行场景和规则的初始化操作开始*********************");
        ruleBizService.init();
        stopWatch.stop();
        log.info("*************项目启动，执行场景和规则的初始化操作结束，共耗时[{}Millis]*********************", stopWatch.getTotalTimeMillis());
    }
}
